import { post, get, put, del } from '@/utils/request';
import { Vector, VectorFormValues} from '@/pages/backhub/vector/store/vectorTypes';

/**
 * 获取向量知识库列表
 * @returns 向量知识库列表
 */
export const getVectorList = async (): Promise<Vector[]> => {
  return get(`/engine/starhub/knowledge/getList`);
};

/**
 * 获取向量知识库
 * @returns 向量知识库信息
 */
export const getInfo = async (id: string): Promise<Vector[]> => {
  return get(`/engine/starhub/knowledge/getInfo/${id}`);
};

/**
 * 创建向量知识库
 * @param values 向量知识库表单值
 * @returns 创建的向量知识库
 */
export const createVector = async (values: VectorFormValues): Promise<Vector> => {
  return post(`/engine/starhub/knowledge/add`, values);
};

/**
 * 更新向量知识库
 * @param id 向量知识库ID
 * @param values 向量知识库表单值
 * @returns 更新的向量知识库
 */
export const updateVector = async (id: string, values: VectorFormValues): Promise<Vector> => {
  values.id=id;
  return post(`/engine/starhub/knowledge/update`, values);
};


/**
 * 删除向量知识库
 * @param id 向量知识库ID
 */
export const deleteVector = async (id: string): Promise<void> => {
  return post(`/engine/starhub/knowledge/delete`, { id });
};


/**
 * 获取可选模型列表
 * @returns 模型列表
 */
export const getActiveModel = async (): Promise<any[]> => {
  return get(`/engine/starhub/model/getActiveModel`);
};
